import request from '@/config/axios'

// 权益保障 VO
export interface BenefitVO {
  id: number | string // 唯一编号
  category: string // 种类
  name: string // 名称
  summary: string // 简介
  iconUrl: string // 图标地址
  linkUrl: string // 跳转链接
}

// 权益保障 API
export const BenefitApi = {
  // 查询权益保障分页
  getBenefitPage: async (params: any) => {
    return await request.get({ url: `/cms/benefit/page`, params })
  },

  // 查询权益保障详情
  getBenefit: async (id: number | string) => {
    return await request.get({ url: `/cms/benefit/get?id=` + id })
  },

  // 新增权益保障
  createBenefit: async (data: BenefitVO) => {
    return await request.post({ url: `/cms/benefit/create`, data })
  },

  // 修改权益保障
  updateBenefit: async (data: BenefitVO) => {
    return await request.post({ url: `/cms/benefit/update`, data })
  },

  // 删除权益保障
  deleteBenefit: async (id: number | string) => {
    return await request.get({ url: `/cms/benefit/delete?id=` + id })
  },

  // 导出权益保障 Excel
  exportBenefit: async (params) => {
    return await request.download({ url: `/cms/benefit/export-excel`, params })
  }
}
